package io;

import java.io.*;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("note.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        System.out.println("输入数据，输入exit 程序退出");
      while(true) {
          System.out.println("请输入：");
          String s = sc.nextLine();
          if ("exit".equalsIgnoreCase(s)) {
              System.out.println("退出");
              break;
          }

          osw.write(s);
          System.out.println("已写入");
      }
        osw.close();
    }
}
